| Total Complexity | 3 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import BaseCard from './BaseCard'; |
||
| 4 | |||
| 5 | export default class MessageDialogCard extends BaseCard { |
||
| 6 | private readonly config: MessageDialogConfig; |
||
| 7 | |||
| 8 | constructor(config: MessageDialogConfig) { |
||
| 9 | super(); |
||
| 10 | this.config = config; |
||
| 11 | } |
||
| 12 | |||
| 13 | create(): chatV1.Schema$GoogleAppsCardV1Card { |
||
| 14 | this.buildHeader(); |
||
| 15 | this.buildSections(); |
||
| 16 | return this.card; |
||
| 17 | } |
||
| 18 | |||
| 19 | buildHeader() { |
||
| 20 | this.card.header = { |
||
| 21 | 'title': this.config.title, |
||
| 22 | 'subtitle': this.config.message, |
||
| 23 | 'imageUrl': this.config.imageUrl, |
||
| 24 | 'imageType': 'CIRCLE', |
||
| 25 | }; |
||
| 26 | } |
||
| 27 | |||
| 28 | buildSections() { |
||
| 29 | this.card.sections = [ |
||
| 30 | { |
||
| 31 | 'widgets': [ |
||
| 32 | { |
||
| 33 | 'divider': {}, |
||
| 34 | }, |
||
| 35 | { |
||
| 36 | 'divider': {}, |
||
| 37 | }, |
||
| 38 | { |
||
| 39 | 'divider': {}, |
||
| 40 | }, |
||
| 41 | { |
||
| 42 | 'divider': {}, |
||
| 43 | }, |
||
| 44 | { |
||
| 45 | 'textParagraph': { |
||
| 46 | 'text': 'If you have any problems, questions, or feedback, ' + |
||
| 47 | 'please feel free to post them <a href="https://github.com/dyaskur/google-chat-poll/issues">here</a> ', |
||
| 48 | }, |
||
| 53 |